
public class Test {
    public static MySingleList.ListNode mergeTwoLists(MySingleList.ListNode head1,
                                               MySingleList.ListNode head2){
        MySingleList.ListNode newHead = new MySingleList.ListNode(12);
        MySingleList.ListNode cur = newHead;
        while(head1 != null && head2 != null){
            if(head1.value < head2.value){
                cur.next = head1;
                cur = cur.next;
                head1 = head1.next;
            }else{
                cur.next = head2;
                cur = cur.next;
                head2 = head2.next;
            }
        }
        if(head1 == null){
            cur.next = head2;
        }
        if(head2 == null){
            cur.next = head1;
        }
        return newHead.next;
    }
    public static void main(String[] args) {
        MySingleList mySingleList = new MySingleList();

        MySingleList.ListNode ret = mySingleList.reserve();
        mySingleList.display(ret);
    }
    public static void main2(String[] args) {
        MyArrayList myArrayList = new MyArrayList();
        myArrayList.display();
        System.out.println("***********************");
        myArrayList.add(1);
        myArrayList.add(3);
        myArrayList.add(5);
        myArrayList.add(7);
        myArrayList.add(9);
        myArrayList.display();
        System.out.println("***********************");
        myArrayList.add(5,99999);
        myArrayList.display();
        System.out.println("***********************");
        System.out.println(myArrayList.contains(8));
        System.out.println("***********************");
        System.out.println(myArrayList.indexOf(10));
        System.out.println("***********************");
        try{
           // int data = myArrayList.get(10);
            int data = myArrayList.get(4);
            System.out.println(data);
        }catch(PosWrongfulException e){
            e.printStackTrace();
        }
        System.out.println("***********************");
        myArrayList.remove(99999);
        myArrayList.display();
        System.out.println("***********************");
        myArrayList.set(4,999);
        myArrayList.display();
    }
}
